#include <bits/stdc++.h>
using namespace std;

class RandomizedSet {
public:
    set<int> stNum;
    RandomizedSet() {

    }

    bool insert(int val) {
        if (stNum.count(val) > 0){
            return false;
        }
        stNum.insert(val);
        return true;
    }

    bool remove(int val) {
        if (stNum.count(val) == 0) {
            return false;
        }
        stNum.erase( stNum.find(val));
        return true;
    }

    int getRandom() {
        int n = stNum.size();
        size_t idx = rand() % n;
        auto it = stNum.begin();
        for(size_t i=0; i<stNum.size(); i++,it++) {
            if (i == idx) {
                return *it;
            }
        }
        return 0;
    }
};

int main_st() {
    int n = 3;
    size_t idx = rand() % n;
    printf("%d\n", idx);
}

/**
 * Your RandomizedSet object will be instantiated and called as such:
 * RandomizedSet* obj = new RandomizedSet();
 * bool param_1 = obj->insert(val);
 * bool param_2 = obj->remove(val);
 * int param_3 = obj->getRandom();
 */
